//------------------------------------------------------------------------------
// The confidential and proprietary information contained in this file may
// only be used by a person authorised under and to the extent permitted
// by a subsisting licensing agreement from ARM Limited.
//
//            (C) COPYRIGHT 2008-2012 ARM Limited.
//                ALL RIGHTS RESERVED
//
// This entire notice must be reproduced on all copies of this file
// and copies of this file may only be made by a person if such person is
// permitted to do so under the terms of a subsisting license agreement
// from ARM Limited.
//------------------------------------------------------------------------------
// Version and Release Control Information:
//
// File Revision       : 127275
// File Date           :  2012-03-19 15:37:15 +0000 (Mon, 19 Mar 2012)
// Release Information : PL401-r0p1-00eac0
//------------------------------------------------------------------------------
//
//        *** AUTOMATICALLY GENERATED, ONLY MODIFY MARKED SECTIONS ***
//
//  Config :
//           o  FIFO Depth      = 2
//
//  Purpose: This file provides functions to determine full and empty status
//           of the read-data FIFO, and a conversion function to change the
//           pointer from gray coded to binary coded
//
//  --=====================================================================--
  
//------------------------------------------------------------------------------
//
// nic400_ib_tpv_gp_apb4_ib_w_fifo FUNCTIONS
//
//------------------------------------------------------------------------------
    
//------------------------------------------------------------------------
// Function : nic400_ib_tpv_gp_apb4_ib_w_fifo_gry_to_bin_fn
//------------------------------------------------------------------------
// convert gray code pointer to binary

function       nic400_ib_tpv_gp_apb4_ib_w_fifo_gry_to_bin_fn;
   input [1:0]  gry_pntr;
   case(gry_pntr)
  
    `NIC400_IB_TPV_GP_APB4_IB_W_FIFO_0_0 : nic400_ib_tpv_gp_apb4_ib_w_fifo_gry_to_bin_fn = 1'd0;
    `NIC400_IB_TPV_GP_APB4_IB_W_FIFO_1_0 : nic400_ib_tpv_gp_apb4_ib_w_fifo_gry_to_bin_fn = 1'd0; 
    
    `NIC400_IB_TPV_GP_APB4_IB_W_FIFO_0_1 : nic400_ib_tpv_gp_apb4_ib_w_fifo_gry_to_bin_fn = 1'd1;
    `NIC400_IB_TPV_GP_APB4_IB_W_FIFO_1_1 : nic400_ib_tpv_gp_apb4_ib_w_fifo_gry_to_bin_fn = 1'd1; 
    
     default : nic400_ib_tpv_gp_apb4_ib_w_fifo_gry_to_bin_fn = {1{1'bx}};
   endcase
endfunction

//------------------------------------------------------------------------
// Function : nic400_ib_tpv_gp_apb4_ib_w_fifo_next_gry_fn
//------------------------------------------------------------------------
// next gray code

function [1:0] nic400_ib_tpv_gp_apb4_ib_w_fifo_next_gry_fn;
   input [1:0]  gry_pntr;
   case(gry_pntr)
    
    `NIC400_IB_TPV_GP_APB4_IB_W_FIFO_0_0 : nic400_ib_tpv_gp_apb4_ib_w_fifo_next_gry_fn = `NIC400_IB_TPV_GP_APB4_IB_W_FIFO_0_1;
    `NIC400_IB_TPV_GP_APB4_IB_W_FIFO_1_0 : nic400_ib_tpv_gp_apb4_ib_w_fifo_next_gry_fn = `NIC400_IB_TPV_GP_APB4_IB_W_FIFO_1_1;
    
    `NIC400_IB_TPV_GP_APB4_IB_W_FIFO_0_1 : nic400_ib_tpv_gp_apb4_ib_w_fifo_next_gry_fn = `NIC400_IB_TPV_GP_APB4_IB_W_FIFO_1_0;
    `NIC400_IB_TPV_GP_APB4_IB_W_FIFO_1_1 : nic400_ib_tpv_gp_apb4_ib_w_fifo_next_gry_fn = `NIC400_IB_TPV_GP_APB4_IB_W_FIFO_0_0;
  
     default : nic400_ib_tpv_gp_apb4_ib_w_fifo_next_gry_fn = `NIC400_IB_TPV_GP_APB4_IB_W_FIFO_x_x;
   endcase
endfunction



//------------------------------------------------------------------------
// Function : nic400_ib_tpv_gp_apb4_ib_w_fifo_empty_fn
//------------------------------------------------------------------------
// check if fifo is empty on read side

function nic400_ib_tpv_gp_apb4_ib_w_fifo_empty_fn;
   input [1:0]  wpntr_gry;
   input [1:0]  rpntr_gry;
   case({wpntr_gry, rpntr_gry})
    
    {`NIC400_IB_TPV_GP_APB4_IB_W_FIFO_0_0,`NIC400_IB_TPV_GP_APB4_IB_W_FIFO_0_0},
    {`NIC400_IB_TPV_GP_APB4_IB_W_FIFO_1_0,`NIC400_IB_TPV_GP_APB4_IB_W_FIFO_1_0},
    
    {`NIC400_IB_TPV_GP_APB4_IB_W_FIFO_0_1,`NIC400_IB_TPV_GP_APB4_IB_W_FIFO_0_1},
    {`NIC400_IB_TPV_GP_APB4_IB_W_FIFO_1_1,`NIC400_IB_TPV_GP_APB4_IB_W_FIFO_1_1} :
    nic400_ib_tpv_gp_apb4_ib_w_fifo_empty_fn = 1'b1;
     default :
      nic400_ib_tpv_gp_apb4_ib_w_fifo_empty_fn = 1'b0;
   endcase
endfunction

//------------------------------------------------------------------------
// Function : nic400_ib_tpv_gp_apb4_ib_w_fifo_full_fn
//------------------------------------------------------------------------
// check if fifo is full on write side

function nic400_ib_tpv_gp_apb4_ib_w_fifo_full_fn;
   input [1:0]  wpntr_gry;
   input [1:0]  rpntr_gry;
   case({wpntr_gry, rpntr_gry})
    
    {`NIC400_IB_TPV_GP_APB4_IB_W_FIFO_0_0,`NIC400_IB_TPV_GP_APB4_IB_W_FIFO_1_0},
    {`NIC400_IB_TPV_GP_APB4_IB_W_FIFO_1_0,`NIC400_IB_TPV_GP_APB4_IB_W_FIFO_0_0},
    
    {`NIC400_IB_TPV_GP_APB4_IB_W_FIFO_0_1,`NIC400_IB_TPV_GP_APB4_IB_W_FIFO_1_1},
    {`NIC400_IB_TPV_GP_APB4_IB_W_FIFO_1_1,`NIC400_IB_TPV_GP_APB4_IB_W_FIFO_0_1} :
    nic400_ib_tpv_gp_apb4_ib_w_fifo_full_fn = 1'b1;
     default :
      nic400_ib_tpv_gp_apb4_ib_w_fifo_full_fn = 1'b0;
   endcase
endfunction



// --================================= End ===================================--
